package net
{
	import Base.Net.NetEvent;
	
	import Common.GameNetEvent;
	import Common.GameNetManager;
	
	import flash.display.SimpleButton;
	
	import ui.ChatUIHandler;
	
	public class NetHandler
	{
		public function NetHandler()
		{
			
		}
		
		public static var instance:NetHandler = null;
		public static function Instance():NetHandler
		{
			if ( instance == null )
			{
				instance = new NetHandler();
			}
			
			return instance;
		}
		
		public function init():void
		{
			NetEvent.registerEvent( GameNetEvent.RECV_CHAT_ID , ChatUIHandler.Instance().onRecvChat );
			
			NetEvent.registerEvent( GameNetEvent.RECV_BATTLE_ID , MapNetHandler.onEnterBattle );
			NetEvent.registerEvent( GameNetEvent.RECV_ENTERMAP_ID , MapNetHandler.onEnterMap );
			NetEvent.registerEvent( GameNetEvent.RECV_NPCENTERMAP_ID , MapNetHandler.onNpcEnterMap );
			
			NetEvent.registerEvent( GameNetEvent.RECV_ROLEINFO_ID , PlayerNetHandler.onRecvRoleInfo );
			NetEvent.registerEvent( GameNetEvent.RECV_GET_PET_ID , PlayerNetHandler.onRecvGetPet );
			
			NetEvent.registerEvent( GameNetEvent.RECV_USE_ITEM_ID , ItemNetHandler.onRecvUseItem );
			
			NetEvent.registerEvent( GameNetEvent.RECV_MAPINFO_ID , MapNetHandler.onRecvMapInfo );
			NetEvent.registerEvent( GameNetEvent.RECV_PLAYERENTERMAP_ID , MapNetHandler.onRecvEnterMap );
			NetEvent.registerEvent( GameNetEvent.RECV_EXITMAP_ID , MapNetHandler.onRecvExitMap );
			NetEvent.registerEvent( GameNetEvent.RECV_MOVE_ID , MapNetHandler.onRecvMove );
			NetEvent.registerEvent( GameNetEvent.RECV_ACTION_ID , MapNetHandler.onRecvAction );
			NetEvent.registerEvent( GameNetEvent.RECV_DIRECTION_ID , MapNetHandler.onRecvDirection );
			NetEvent.registerEvent( GameNetEvent.RECV_JOIN_TEAM_ID , MapNetHandler.onRecvJoinTeam );
			NetEvent.registerEvent( GameNetEvent.RECV_LEAVE_TEAM_ID , MapNetHandler.onRecvLeaveTeam );
			NetEvent.registerEvent( GameNetEvent.RECV_SYN_TEAM_ID , MapNetHandler.onRecvSynTeam );
			
			NetEvent.registerEvent( GameNetEvent.RECV_SYN_TEAM_MAP_ID , MapNetHandler.onRecvSynTeamMap );
			
			NetEvent.registerEvent( GameNetEvent.RECV_TALK_NPC_ID , NpcNetHandler.onRecvTalkNpc );
			
			
		}
		
		public function release():void
		{
			
			
			
			
		}
		
		
	}
}


